<template>
  <div id="demo"></div>
</template>
<script>
import Pdfh5 from 'pdfh5';
export default {
  name: 'App',
  data() {
    return {
      pdfh5: null
    };
  },
  mounted() {
    //实例化
    this.pdfh5 = new Pdfh5('#demo', {
      pdfurl:
        'https://auth-setting.oss-cn-shanghai.aliyuncs.com/market_activity/0f1e217330f2416a9f960b1fd71b5c91.pdf'
      // 'https://manniudoctor.oss-cn-shanghai.aliyuncs.com/dev/uploadFile/c0e348d5-cdb5-463a-bfcf-de3f09890865'
    });
    //监听完成事件
    this.pdfh5.on('complete', function(status, msg, time) {
      console.log(
        '状态：' +
          status +
          '，信息：' +
          msg +
          '，耗时：' +
          time +
          '毫秒，总页数：' +
          this.totalNum
      );
    });
  },
  methods: {
    // 获取元素的行数
    getCountLines(ele) {
      const styles = window.getComputedStyle(ele, null);
      const lh = parseInt(styles.lineHeight, 10);
      const h = parseInt(styles.height, 10);
      const lc = Math.round(h / lh);
      console.log('line count:', lc, 'line-height:', lh, 'height:', h);
      return lc;
    }
  }
};
</script>
<style>
#demo {
  width: 100vw;
  height: 100%;
  background-color: #d62222;
  margin: 0;
  padding: 0;
}
</style>
